package com.googlecode.prp;

public final class DisplayResolution {

	private final int displayWidth;
	private final int displayHeight;

	public static final class Builder {

		private int displayWidth = 0;
		private int displayHeight = 0;

		public Builder displayWidth(final int displayWidth) {
			this.displayWidth = displayWidth;
			return this;
		}

		public Builder displayHeight(final int displayHeight) {
			this.displayHeight = displayHeight;
			return this;
		}

		public DisplayResolution build() {
			return new DisplayResolution(this);
		}

	}

	private DisplayResolution(final Builder builder) {
		displayWidth = builder.displayWidth;
		displayHeight = builder.displayHeight;
	}

	public int getDisplayWidth() {
		return displayWidth;
	}

	public int getDisplayHeight() {
		return displayHeight;
	}

	@Override
	public String toString() {
		return "DisplayResolution [displayWidth=" + displayWidth
				+ ", displayHeight=" + displayHeight + "]";
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + displayHeight;
		result = prime * result + displayWidth;
		return result;
	}

	@Override
	public boolean equals(final Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		final DisplayResolution other = (DisplayResolution) obj;
		if (displayHeight != other.displayHeight)
			return false;
		if (displayWidth != other.displayWidth)
			return false;
		return true;
	}

}
